Count words in a string method